home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 4664 / 4664.xpi / chrome / twitterbar.jar / content / OneRiotSearchDialog-twitterbar-ff.xul < prev    next >
Extensible Markup Language  |  2010-02-08  |  3KB  |  63 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE overlay SYSTEM "chrome://twitterbar/locale/overlay.dtd" >
  3. <?xml-stylesheet type="text/css" href="chrome://global/skin/global.css"?>
  4. <dialog title="Social Web Search for TwitterBar"
  5.     id="twitterbar-one-riot-dialog"
  6.     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  7.     buttons="accept,cancel"
  8.     defaultButton="cancel"
  9.     buttondisabledaccept="true"
  10.     ondialogaccept="return addSearchProvider();"
  11.     ondialogcancel="return cancelSearchProvider();"> 
  12.     
  13.     <stringbundleset id="stringbundleset">
  14.         <stringbundle id="twitterbar-strings" src="chrome://twitterbar/locale/overlay.properties" />
  15.     </stringbundleset>
  16.     
  17.     <script type="application/x-javascript">
  18.         <![CDATA[
  19.             var addSearchProvider = function () {
  20.                 if (document.getElementById("understand").checked) {
  21.                     var engineLabel = document.getElementById("twitterbar-strings").getString("twitter.search.name");
  22.                     const searchService = Components.classes[ "@mozilla.org/browser/search-service;1"].getService(Components.interfaces.nsIBrowserSearchService);
  23.                     searchService.addEngineWithDetails(engineLabel, "http://www.oneriot.com/images/favicon.ico", null, document.getElementById("twitterbar-strings").getString("twitter.search.description"), "get", "http://www.oneriot.com/search?q={searchTerms}&format=html&ssrc=browserBox&spid=86f2f5da-3b24-4a87-bbb3-1ad47525359d&p=twitterbar-ff");
  24.                 
  25.                     // Make OneRiot the default
  26.                     const prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
  27.                     const preferences = prefService.getBranch("browser.");
  28.                     preferences.setCharPref("search.selectedEngine", engineLabel);
  29.                 
  30.                     // Make OneRiot the current engine
  31.                     var engine = searchService.getEngineByName(engineLabel);
  32.                     searchService.currentEngine = engine;
  33.                 }
  34.  
  35.                 return true;
  36.             }
  37.             
  38.             var cancelSearchProvider = function () {
  39.                 if (document.getElementById("understand").checked) {
  40.                     document.getElementById("understand").checked = false;
  41.                     document.getElementById('twitterbar-one-riot-dialog').setAttribute('buttondisabledaccept', true);
  42.                     return false;
  43.                 }
  44.  
  45.                 return true;
  46.             }
  47.  
  48.         ]]>
  49.     </script>
  50.     <hbox>
  51.         <vbox>
  52.             <image src="chrome://twitterbar/skin/search-trio.png" style="padding: 20px;"/>
  53.         </vbox>
  54.         <vbox style="width: 350px; padding-left: 20px;" align="center" pack="center">
  55.             <description>&twitter.search.p1;</description>
  56.             <image src="chrome://twitterbar/skin/search-example.png" style="padding-top: 5px; padding-bottom: 5px;" />
  57.             <description>&twitter.search.p2;</description>
  58.             <hbox align="center">
  59.                 <checkbox id="understand" label="&twitter.search.checkbox;" oncommand="document.getElementById('twitterbar-one-riot-dialog').setAttribute('buttondisabledaccept', !this.checked);" />
  60.             </hbox>
  61.         </vbox>
  62.     </hbox>
  63. </dialog>